Skip to content

Keep the cross-approximation bases when the SVD does not converge - #49

Merged
mcencini merged 2 commits into
mainfrom
claude/project-thread-s8xwsw
Oct 28, 2026
Merged

mcencini merged 2 commits into
mainfrom
claude/project-thread-s8xwsw

Conversation

@mcencini

@mcencini mcencini commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Matteo · project thread

On the GitHub runners, two _cross_coupling tests fail on CPU with linalg.svd: The algorithm failed to converge. This happens on both dependabot PRs (#47 and #48) and repeated on a re-run. Each round the body and coil bases are extended with sampled columns that they already partly span, so the singular values cluster at one and near zero. The same torch 2.15.0+cpu wheel converges on an Intel Xeon here, so the failure depends on the CPU. On the runners it fails even on the small triangular factor after QR.

_left_singular_vectors reduces the matrix with QR and takes the SVD of the triangular factor. If that SVD raises, it takes the vectors from the eigendecomposition of the factor's Gram matrix instead, strongest first. The two agree on every vector whose singular value stands above √ε, and the core fit in _fitted_core drops everything below that anyway.

Tests, on CPU and CUDA: an extended basis keeps its span in its strongest singular vectors on both paths, with the SVD made to fail for the second. Locally, all of tests/test_implicit.py also passes with the eigendecomposition path forced on. Results: format_and_lint.sh clean, and tests/test_implicit.py gives 13 passed (13 CUDA skipped).

🤖 Generated with Claude Code

https://claude.ai/code/session_01MFB6QLC6geNXiEorQzmJ6r

@mcencini mcencini self-assigned this Oct 28, 2026
@mcencini mcencini changed the title Orthonormalise the cross-approximation bases through QR before the SVD Keep the cross-approximation bases when the SVD does not converge Oct 28, 2026
@codecov

codecov Bot commented Oct 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/mariepy/implicit.py 0.00% 12 Missing ⚠️

📢 Thoughts on this report? Let us know!

@mcencini
mcencini merged commit 9f42a93 into main Oct 28, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants